from django.db import models
from django.contrib import admin
from forfood.restaurant.models import Restaurant

class Menu(models.Model):

    menu_name = models.CharField(max_length = 20, unique = True)
    restaurant = models.ForeignKey(Restaurant)
    #in_use = models.IntegerField()
    def __unicode__(self):
        return self.menu_name
class MenuAdmin(admin.ModelAdmin):
    pass
admin.site.register(Menu, MenuAdmin)

class MenuCategory(models.Model):
    menu = models.ForeignKey(Menu)
    name = models.CharField(max_length = 20, unique = True)
    def __unicode__(self):
        return self.name
    def get_menu_items(self):
    	return self.menuitem_set.all()
    	
class MenuCategoryAdmin(admin.ModelAdmin):
    pass
admin.site.register(MenuCategory, MenuCategoryAdmin)

class MenuItem(models.Model):
    name = models.CharField(max_length = 20, unique = True)
    price = models.IntegerField()
    description = models.CharField(max_length = 100)
    category = models.ForeignKey(MenuCategory)
    def __unicode__(self):
        return self.name
class MenuItemAdmin(admin.ModelAdmin):
    pass
admin.site.register(MenuItem, MenuItemAdmin)


    
